<?php
@header('Content-Type: text/html; charset=utf-8');
define("URLROOT", "http://tanghn.xicp.net/");

$con = mysql_connect("127.0.0.1","root","redhat");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("test", $con);
mysql_query("set names utf8");

$openid = $_GET[openid];
echo "openid is ".$openid."</br>";
$menuid = $_GET[menuid];
echo "menuid is ".$menuid."</br>";

$sqlSentence = "SELECT * FROM kfcmenu WHERE menuid = ".$menuid;
$result = mysql_query($sqlSentence);
DEBUGINFO("###mysql access: ".$sqlSentence." ###result is ".$result."\r\n");

while($row = mysql_fetch_array($result))
{
	$fullurl = URLROOT.$row['imageurl'];
	echo "<p>";

	echo "<table border='1'><tr><td><image src=$fullurl></td></tr></table>";
	/*<img src="{$fullurl }"width="1644" height="1046">*/

	/*echo "<img src=\"". "http://tanghn.xicp.net/8.gif" ."\" />";*/
	echo "<br />";
	echo htmlspecialchars(stripslashes($row['name']));
	echo "<br />价格: ";
	echo stripslashes($row['price']);
	echo "<br />简介: ";
	echo stripslashes($row['description']);
	echo "</p>";
}

$sqlSentence = "insert into click values('".$openid."',".$menuid.",now());";
$result = mysql_query($sqlSentence);
DEBUGINFO("###mysql access: ".$sqlSentence." ###result is ".$result."\r\n");

mysql_close($con);

function DEBUGINFO($abc)
{
	@ $fp = fopen("debug.txt", 'ab');
	fwrite($fp, $abc);
	fclose($fp);
}

?>